package com.haust.leyou.api;

import com.haust.leyou.pojo.SpecGroup;
import com.haust.leyou.pojo.SpecParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Auther: csp1999
 * @Date: 2020/12/13/12:00
 * @Description: 商品规格参数相关api
 */
@RequestMapping("/spec")
public interface SpecificationApi {

    /**
     * 根据gid,cid,generic,searching 查询规格参数
     *
     * @param gid       商品规格组gid
     * @param cid       商品分类cid
     * @param generic   是否是sku通用属性，true或false
     * @param searching 是否用于搜索过滤，true或false
     * @return
     */
    @GetMapping("/params")
    public List<SpecParam> queryParams(
            @RequestParam(value = "cid", required = false) Long cid,
            @RequestParam(value = "gid", required = false) Long gid,
            @RequestParam(value = "generic", required = false) Boolean generic,
            @RequestParam(value = "searching", required = false) Boolean searching);

    /**
     * 根据cid 查询SpecGroup集合
     *
     * @param cid
     * @return
     */
    @GetMapping("/group/param/{cid}")
    public List<SpecGroup> queryGroupsWithParam(@PathVariable("cid") Long cid);
}
